﻿<%@ Page Title="" Language="C#" MasterPageFile="~/SiteUser.Master" AutoEventWireup="true" CodeBehind="DocumentUser.aspx.cs" Inherits="WebPresentation.DocumentUser" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
<link rel="Stylesheet" href="Styles/jquery-ui-1.8.20.custom.css" />
<script type="text/javascript" src="Scripts/jquery.ui.datepicker.js"></script>
<script type="text/javascript" src="Scripts/jquery-1.7.2.min.js"></script>
<script type="text/javascript" src="Scripts/jquery-ui-1.8.20.custom.min.js"></script>
    <script type="text/javascript">
        $(function () {
            $("#MainContent_txtdate1").datepicker({ dateFormat: 'dd-mm-yy' });
            $("#MainContent_txtdate2").datepicker({ dateFormat: 'dd-mm-yy' });
            $('.hiddenField, #MainContent_dtgdocuser th:nth-child(1)').hide();

            $('#MainContent_dtgdocuser tr').each(function () {
                var storePath = $(this).find("td.storePath").text();
                $(this).find("td.storePath").html("<a href=\"" + storePath + "\">Download</a>");
            });
        });
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <div align="center">
    
    <asp:Label ID="Label10" runat="server" Width="100%" ForeColor="Red" 
        Font-Bold="True"></asp:Label>
    
</div>
<br />

<div id="advsearch">
    <fieldset>
<legend>Adv Search:</legend>       
                <table style="width:100%;" cellspacing="10px">
                    <tr>
                        <td align="right" class="style6" width="50%">
                            <asp:Label ID="Label9" runat="server" Font-Bold="True" Text="Doc Code:" 
                                Width="120px" style="text-align:left"></asp:Label>
                        </td>
                        <td width="25%">
                            <asp:TextBox ID="txtsearchcode" runat="server"></asp:TextBox>
                        </td>
                        <td>
                            <asp:RadioButton ID="cbDocCode" runat="server" GroupName="search" />
                        </td>
                    </tr>
                    
                    <tr>
                        <td align="right" class="style6" width="50%">
                            <asp:Label ID="Label12" runat="server" Font-Bold="True" Text="From Date:" 
                                Width="120px" style="text-align:left"></asp:Label>
                        </td>
                        <td width="25%">
                            <asp:TextBox ID="txtdate1" runat="server" ></asp:TextBox>
                        </td>
                        <td>
                            <asp:RadioButton ID="cbFromDate" runat="server" GroupName="search" />
                        </td>
                    </tr>
                    <tr>
                        <td align="right" class="style6" width="50%">
                        
                            <asp:Label ID="Label17" runat="server" Font-Bold="True" Text="To Date:" 
                                Width="120px" style="text-align:left"></asp:Label>
                        
                        </td>
                        <td width="25%">
                            <asp:TextBox ID="txtdate2" runat="server"></asp:TextBox>
                        </td>
                        <td>
                            &nbsp;</td>
                    </tr>
                    <tr>
                        <td align="right" class="style6" width="50%">
                        
                            <asp:Label ID="Label11" runat="server" Font-Bold="True" Text="Sender:" 
                                Width="120px" style="text-align:left"></asp:Label>
                        
                        </td>
                        <td width="25%">
                            <asp:DropDownList ID="DropDownSearchSender" runat="server" 
                                DataSourceID="DepartmentSource" DataTextField="depName" 
                                DataValueField="depID">
                            </asp:DropDownList>
                            <asp:ObjectDataSource ID="DepartmentSource" runat="server" 
                                DeleteMethod="DeleteDepartment" InsertMethod="InsertDepartment" 
                                OldValuesParameterFormatString="original_{0}" SelectMethod="GetAllDepartments" 
                                TypeName="BusinessLogic.DepartmentBO" UpdateMethod="UpdateDepartment">
                                <DeleteParameters>
                                    <asp:Parameter Name="depID" Type="Int32" />
                                </DeleteParameters>
                                <InsertParameters>
                                    <asp:Parameter Name="depName" Type="String" />
                                    <asp:Parameter Name="depCode" Type="String" />
                                </InsertParameters>
                                <UpdateParameters>
                                    <asp:Parameter Name="depName" Type="String" />
                                    <asp:Parameter Name="depCode" Type="String" />
                                    <asp:Parameter Name="depID" Type="Int32" />
                                </UpdateParameters>
                            </asp:ObjectDataSource>
                        </td>
                        <td>
                            <asp:RadioButton ID="cbSender" runat="server" GroupName="search" />
                        </td>
                    </tr>
                    <tr>
                        <td align="right" class="style6" width="50%">
                            <asp:Label ID="Label13" runat="server" Font-Bold="True" Text="Doc Type:" 
                                Width="120px" style="text-align:left"></asp:Label>
                        </td>
                        <td>
                            <asp:DropDownList ID="ddltype" runat="server" DataSourceID="DocTypeSource" 
                                DataTextField="dtName" DataValueField="dtID">
                            </asp:DropDownList>
                            <asp:ObjectDataSource ID="DocTypeSource" runat="server" 
                                DeleteMethod="DeleteDocType" InsertMethod="AddNewDocType" 
                                OldValuesParameterFormatString="original_{0}" SelectMethod="GetAllDocTypes" 
                                TypeName="BusinessLogic.DocTypeBO" UpdateMethod="UpdateDocTypes">
                                <DeleteParameters>
                                    <asp:Parameter Name="dtID" Type="Int32" />
                                </DeleteParameters>
                                <InsertParameters>
                                    <asp:Parameter Name="dtName" Type="String" />
                                    <asp:Parameter Name="dtCode" Type="String" />
                                </InsertParameters>
                                <UpdateParameters>
                                    <asp:Parameter Name="dtName" Type="String" />
                                    <asp:Parameter Name="dtCode" Type="String" />
                                    <asp:Parameter Name="dtID" Type="Int32" />
                                </UpdateParameters>
                            </asp:ObjectDataSource>
                            <asp:ObjectDataSource ID="DocTypeObjectSource" runat="server" 
                                DeleteMethod="DeleteDocType" InsertMethod="AddNewDocType" 
                                OldValuesParameterFormatString="original_{0}" SelectMethod="GetAllDocTypes" 
                                TypeName="BusinessLogic.DocTypeBO" UpdateMethod="UpdateDocTypes">
                                <DeleteParameters>
                                    <asp:Parameter Name="dtID" Type="Int32" />
                                </DeleteParameters>
                                <InsertParameters>
                                    <asp:Parameter Name="dtName" Type="String" />
                                    <asp:Parameter Name="dtCode" Type="String" />
                                </InsertParameters>
                                <UpdateParameters>
                                    <asp:Parameter Name="dtName" Type="String" />
                                    <asp:Parameter Name="dtCode" Type="String" />
                                    <asp:Parameter Name="dtID" Type="Int32" />
                                </UpdateParameters>
                            </asp:ObjectDataSource>
                        </td>
                        <td>
                            <asp:RadioButton ID="cbDocType" runat="server" GroupName="search" />
                        </td>
                    </tr>
                    <tr>
                        <td align="center" colspan="3" width="100%">
                            <asp:ImageButton ID="ImageButtonadvSearch" runat="server" 
                        ImageUrl="~/Images/searchbtn.png" onclick="ImageButtonadvSearch_Click" />
                        </td>
                    </tr>
                </table>
                </fieldset>
        </div>
<fieldset>
    <legend>Details:</legend>
    <div>
        
        <asp:GridView ID="dtgdocuser" runat="server" CellPadding="4" 
            ForeColor="#333333" GridLines="None" Width="100%" AllowPaging="True" 
            AllowSorting="True" AutoGenerateColumns="False" DataKeyNames="docID" 
            DataSourceID="ObjectDataSource1">
            <AlternatingRowStyle BackColor="White" />
            <Columns>
                <asp:BoundField DataField="docID" HeaderText="docID" InsertVisible="False" 
                    ReadOnly="True" SortExpression="docID" >
                <ItemStyle CssClass="hiddenField" />
                </asp:BoundField>
                <asp:BoundField DataField="DocCode" HeaderText="DocCode" ReadOnly="True" 
                    SortExpression="DocCode" />
                <asp:BoundField DataField="Sender" HeaderText="Sender" 
                    SortExpression="Sender" />
                <asp:BoundField DataField="shortenedDetail" HeaderText="shortenedDetail" 
                    SortExpression="shortenedDetail" />
                <asp:BoundField DataField="storePath" HeaderText="storePath" 
                    SortExpression="storePath" >
                <ItemStyle CssClass="storePath" />
                </asp:BoundField>
                <asp:BoundField DataField="dateOfReceipt" HeaderText="dateOfReceipt" 
                    SortExpression="dateOfReceipt" />
            </Columns>
            <FooterStyle BackColor="#990000" Font-Bold="True" ForeColor="White" />
            <HeaderStyle BackColor="#990000" Font-Bold="True" ForeColor="White" />
            <PagerStyle BackColor="#FFCC66" ForeColor="#333333" HorizontalAlign="Center" />
            <RowStyle BackColor="#FFFBD6" ForeColor="#333333" />
            <SelectedRowStyle BackColor="#FFCC66" Font-Bold="True" ForeColor="Navy" />
            <SortedAscendingCellStyle BackColor="#FDF5AC" />
            <SortedAscendingHeaderStyle BackColor="#4D0000" />
            <SortedDescendingCellStyle BackColor="#FCF6C0" />
            <SortedDescendingHeaderStyle BackColor="#820000" />
        </asp:GridView>
        
        <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" 
            DeleteMethod="Delete" InsertMethod="AddNewDocument" 
            OldValuesParameterFormatString="original_{0}" 
            SelectMethod="GetApprovedDocByRecipient" TypeName="BusinessLogic.DocumentBO" 
            UpdateMethod="Update">
            <DeleteParameters>
                <asp:Parameter Name="docID" Type="Int32" />
            </DeleteParameters>
            <InsertParameters>
                <asp:Parameter Name="docNumber" Type="Int32" />
                <asp:Parameter Name="dtID" Type="Int32" />
                <asp:Parameter Name="docSender" Type="Int32" />
                <asp:Parameter Name="dateOfReceipt" Type="DateTime" />
                <asp:Parameter Name="adoptedBy" Type="Int32" />
                <asp:Parameter Name="inOut" Type="Boolean" />
                <asp:Parameter Name="shortenedDetail" Type="String" />
                <asp:Parameter Name="storePath" Type="String" />
            </InsertParameters>
            <SelectParameters>
                <asp:SessionParameter Name="depID" SessionField="UserDepartmentID" 
                    Type="Int32" />
            </SelectParameters>
            <UpdateParameters>
                <asp:Parameter Name="docNumber" Type="Int32" />
                <asp:Parameter Name="dtID" Type="Int32" />
                <asp:Parameter Name="docSender" Type="Int32" />
                <asp:Parameter Name="dateOfReceipt" Type="DateTime" />
                <asp:Parameter Name="shortenedDetail" Type="String" />
                <asp:Parameter Name="storePath" Type="String" />
                <asp:Parameter Name="status" Type="Boolean" />
                <asp:Parameter Name="docID" Type="Int32" />
            </UpdateParameters>
        </asp:ObjectDataSource>
        
    </div>
</fieldset>
</asp:Content>
